package com.sds.shop.action;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sds.fw.mvc.Action;
import com.sds.fw.mvc.HttpUtil;
import com.sds.shop.dao.OrderDAO;
import com.sds.shop.vo.OrderVO;

public class OrderStateChangeAction extends Action {
	public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
		String ord_no = request.getParameter("ord_no");
		String state = request.getParameter(ord_no);
		String memId = request.getParameter("memId");
		
		OrderDAO.getInstance().changeOrderState(ord_no, state);		
		ArrayList<OrderVO> list = OrderDAO.getInstance().getOrderList(memId);			
		
		request.setAttribute("orderList", list);			
		HttpUtil.forward(request, response, "/jsp/orderList.jsp");
		
		System.out.println(ord_no + "  " + state);
	}
}
